/*获取收货地址*/
discountdata(123)
function discountdata (val) {
    if(val==123){
        //初始化 省
        var user_data = {
            level: '101',
            // memberId:'10258',
        }
        var succCallBack = function (data, status, response) {
            if(data.errorCode=="1"){
                var tab_data=data.list;
                if(tab_data==''){
                    cer+='<option value=""></option>'
                    $("#getArea").html(cer);
                }else{
                    var cer="<option value=''>请选择收货区域</option>"
                    for(var i=0; i<tab_data.length; i++){
                        cer+='<option value="'+tab_data[i].address_id+'">'+tab_data[i].name+'</option>'
                    }
                    $("#getArea").html(cer);
                }
            }
        };
        web.doAjax(root.orderInter.order_return_address,'post',user_data, succCallBack);
    }else if(val==1){
        //市
        var special=$('#getArea').val()
        if(special==""){
            var cer="<option value=''>请选择收货位置</option>"
            $("#getPlace").html(cer);
        }else {
            var user_data = {
                level: '102',
                // memberId:'10258',
                addressIdStr:special
            }
            var succCallBack = function (data, status, response) {
                if(data.errorCode=="1"){
                    var tab_data=data.list;
                    if(tab_data==''){
                        cer+='<option value=""></option>'
                        $("#getPlace").html(cer);
                    }else{
                        var cer="<option value=''>请选择收货位置</option>"
                        for(var i=0; i<tab_data.length; i++){
                            cer+='<option value="'+tab_data[i].address_id+'">'+tab_data[i].name+'</option>'
                        }
                        $("#getPlace").html(cer);
                    }
                }
            };
            web.doAjax(root.orderInter.order_return_address,'post',user_data, succCallBack);
        }
    }
}
/*表格渲染*/
var dataSource = new Array();
//table的数据源
var table;   //table对象
dataSource = [];
function orderList(data){
    dataSource.splice(0, dataSource.length);//清空数组
    if(data.result!=null){
        $.each(data.result, function (i, field) {
            var rowData = new Array();
            rowData.push(field.refund_id);//申请单号
            rowData.push(field.platform);
            // rowData.push(field.refund_id);//退货渠道
            rowData.push(field.refund_role);
            rowData.push(field.order_id);
            rowData.push(field.customer_name);
            rowData.push(field.refund_sorce);
            rowData.push(field.refund_reason);
            // rowData.push(field.paid_type);
            rowData.push(field.refund_amount_final);
            rowData.push(field.created_at);
            rowData.push(field.audit_time);
            rowData.push(field.refund_status);
            rowData.push(field.customer_refund_reason);

            dataSource.push(rowData);
        });
    }
    initDataTable(data);
}

function initDataTable(data) {
        var refund_amount_finals=""
        var rst =data.result;
        var prdcuhtml='';
        var platformname='';
        var rowspanStr='';
        if(rst!=null&&rst!=""){
            if(rst.length >0){
                $.each(rst,function(i,item){
                    if(item.refund_amount_final!=null){
                        refund_amount_finals='¥'+item.refund_amount_final
                    }else {
                        refund_amount_finals=""
                    }
                    prdcuhtml +='<div class="orer_item">'
                    prdcuhtml +='<div class="list_box list_over">'
                    prdcuhtml +='<div class="title">'
                    prdcuhtml +='<span>申请单号：'+item.refund_id+'</span>'
                    prdcuhtml +='<span>订单号：'+item.order_id+'</span>'
                    if(item.platform == 20){
                        platformname='签约平台'
                    }else if(item.platform == 10){
                        platformname='普通平台'
                    }else{
                        platformname=''
                    }
                    prdcuhtml +='<span>订单来源：'+platformname+'</span>'
                    prdcuhtml +='</div>'
                    prdcuhtml +='<table class="table table-border table-bg table-sort list_box_table ">'
                    prdcuhtml +='<tbody>'
                    if(item.products!="" &&item.products!=null){
                        $.each(item.products,function(j,ite){
                            if (j < 3) {
                                prdcuhtml += '<tr>';
                            } else {
                                prdcuhtml += '<tr style = "display:none;">';
                            }
                            rowspanStr =item.products.length;

                            prdcuhtml +='<td width="40px" rowspan="1">'
                            prdcuhtml +=' <img class="imgaff" src="'+imgSize(ite.product_pic)+'">'
                            prdcuhtml +='</td>'
                            prdcuhtml +='<td width="60px" rowspan="1" > '
                            prdcuhtml +='<div>'+ite.product_code+'</div>'
                            prdcuhtml +='<div>'+ite.product_name+'</div>'
                            prdcuhtml +='<div>'+ite.color+'</div>'
                            prdcuhtml +='<div>'+ite.sku_info+'</div>'
                            prdcuhtml +='</td>'
                            prdcuhtml +='<td width="20px" rowspan="1">X'+ ite.refund_count+''+ite.unit_name+'</td>'
                            if(j == 0 ){

                                prdcuhtml +='<td width="30px" rowspan="'+rowspanStr+'">'+chanlefn(item.refund_role)+'</td>'

                                prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'">'+item.customer_name+'</td>'
                                prdcuhtml +='<td width="50px" rowspan="'+rowspanStr+'"> '+rejct(item.refund_sorce)+'</td>'
                                if(item.customer_refund_reason != 0){
                                    prdcuhtml +=' <td width="50px"  rowspan="'+rowspanStr+'">'+afsleresonfn(item.customer_refund_reason)+'</td>'
                                }else{
                                    prdcuhtml +=' <td width="50px"  rowspan="'+rowspanStr+'"> '+refundreasonfn(item.refund_reason)+'</td>'
                                }

                                prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'"> '+refund_amount_finals+'</td>'
                                prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'">'+item.created_at+'</td>'
                                if(item.audit_time != null){
                                    prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'">'+item.audit_time+'</td>'
                                }else{
                                    prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'"></td>'
                                }

                                prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'">'+refundstatus(item.refund_status)+'</td>'
                                prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'">'
                                prdcuhtml +='<div>'

                                prdcuhtml +='</div>'
                                prdcuhtml +='<div>'
                                prdcuhtml +='<a onclick="orderInfo(\'申请单详情\',\'afterSaleService-returns.html\',\''+item.refund_id+'\',\''+item.order_id+'\')" class="col_blue" target="_blank">查看</a>'
                                prdcuhtml +='</div>'
                            }
                        })

                        prdcuhtml +='</td>'
                        prdcuhtml +=' </tr>'
                        prdcuhtml +=' </tbody>'
                        prdcuhtml +='</table>'
                        prdcuhtml +='</div>'
                        if(item.products.length >3){
                            prdcuhtml +='<div class="list_more " onclick="show_list_more(this,'+rowspanStr+',0);">'
                            prdcuhtml +='<a href="javascript:void(0);">退货了<span id="list_length">'+rowspanStr+'</span>件商品  <span id="operText">更多</span><i class="icon"></i></a>'
                            prdcuhtml +='</div>'
                        }
                    }else {

                        prdcuhtml += '<tr>';

                        rowspanStr =1

                        prdcuhtml +='<td width="40px" rowspan="1">'
                        prdcuhtml +=' <img class="imgaff" src="">'
                        prdcuhtml +='</td>'
                        prdcuhtml +='<td width="60px" rowspan="1" > '
                        prdcuhtml +='<div></div>'
                        prdcuhtml +='<div></div>'
                        prdcuhtml +='<div></div>'
                        prdcuhtml +='<div></div>'
                        prdcuhtml +='</td>'
                        prdcuhtml +='<td width="20px" rowspan="1"></td>'


                        prdcuhtml +='<td width="30px" rowspan="'+rowspanStr+'">'+chanlefn(item.refund_role)+'</td>'

                        prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'">'+item.customer_name+'</td>'
                        prdcuhtml +='<td width="50px" rowspan="'+rowspanStr+'"> '+rejct(item.refund_sorce)+'</td>'
                        if(item.customer_refund_reason != 0){
                            prdcuhtml +=' <td width="50px"  rowspan="'+rowspanStr+'">'+afsleresonfn(item.customer_refund_reason)+'</td>'
                        }else{
                            prdcuhtml +=' <td width="50px"  rowspan="'+rowspanStr+'"> '+refundreasonfn(item.refund_reason)+'</td>'
                        }

                        prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'"> '+refund_amount_finals+'</td>'
                        prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'">'+item.created_at+'</td>'
                        if(item.audit_time != null){
                            prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'">'+item.audit_time+'</td>'
                        }else{
                            prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'"></td>'
                        }

                        prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'">'+refundstatus(item.refund_status)+'</td>'
                        prdcuhtml +='<td width="50px"  rowspan="'+rowspanStr+'">'
                        prdcuhtml +='<div>'

                        prdcuhtml +='</div>'
                        prdcuhtml +='<div>'
                        prdcuhtml +='<a onclick="orderInfo(\'申请单详情\',\'afterSaleService-returns.html\',\''+item.refund_id+'\',\''+item.order_id+'\')" class="col_blue" target="_blank">查看</a>'
                        prdcuhtml +='</div>'

                        prdcuhtml +='</td>'
                        prdcuhtml +=' </tr>'
                        prdcuhtml +=' </tbody>'
                        prdcuhtml +='</table>'
                        prdcuhtml +='</div>'
                    }


                    prdcuhtml +='</div>'

                })

                $("#orderList").html(prdcuhtml)
            };
        }else {
            $("#orderList").html(prdcuhtml)
        }





 
    }

//点击查看更多
function show_list_more(dom, length,status){
    var curPrevClass = status==20 ? '.sub_order' : '.list_box';
    if ($(dom).find('#operText').text() == '更多'){ //展开
      $(dom).prev(curPrevClass).find('.list_box_table tr:gt(2)').show();
      $(dom).prev(curPrevClass).find('.list_box_table tr:eq(0) td:gt(3)').attr({
        "rowspan": length
      });
      $(dom).find('#operText').text('收起');
    } else { //收起
      $(dom).prev(curPrevClass).find('.list_box_table tr:gt(2)').hide();
      $(dom).prev(curPrevClass).find('.list_box_table tr:eq(0) td:gt(3)').attr({
        "rowspan": 3
      });
      $(dom).find('#operText').text('更多');
    }
}
//状态
function refundstatus(code){
    switch (code) {
        case 10:
            return "待审核"
            break;
        case 30:
            return "退货处理"
            break;
        case 40:
            return "退款处理"
            break;
        case 50:
            return "已完成"
            break;
        case 60:
            return "已关闭"
            break;
    }
}
//退货渠道
function chanlefn(code){
    switch (code) {
        case 10:
            return "买家";
        case 20:
            return "客服";
        case 30:
            return "门店";
        case 40:
            return "线下"
        default:
            return ''
    }
}
//类型 拒收
function rejct(code){
            
    switch (code) {
        case 10:
            return "拒收";
        case 11:
            return "拒收-拦截";
        case 20:
            return "退货";
        default:
            return "";
    }
}
//退货原因
function afsleresonfn(code){

    switch (code) {
        case 10:
            return "商品质量问题";
            break;
        case 11:
            return "客户原因";
            break;
        case 20:
            return "大小/型号与商品描述不符";
            break;
        case 30:
            return "颜色/图案与商品描述不符";
            break;
        case 40:
            return "功能/效果与商品描述不符";
            break;
        case 50:
            return "商城发错货";
            break;
        case 60:
            return "少件/漏发";
            break;
        case 70:
            return "多买/买错不想要了";
            break;
        case 80:
            return "到货物流破损";
            break;
        case 90:
            return "发票问题";
            break;
        case 100:
            return "未按约定时间送货";
            break;
        case 110:
            return "其他原因";
            break;

        case 120:
            return "收到商品与网站展示不符";
            break;
        case 130:
            return "客户原因无理由退货";
            break;
        case 140:
           return "资质问题";
            break;
        case 51:
                return "客户订购错误/计划有变";
                break;
            case 52:
                return "价格高";
                break;
            case 53:
                return "无法满足到货时效";
                break;
            case 54:
                return "支付问题";
                break;
            case 55:
                return "重复下单";
                break;
            case 56:
                return "暂时不需要了";
                break;
            case 57:
                return "订单信息有误";
                break;
            case 58:
                return "无货";
                break;
            case 59:
                return "其他";
                break;
            case 60:
                return "少件/漏发";
                break;
            case 61:
                return "商品质量问题";
                break;
            case 62:
                return "价格错误";
                break;    
            default:'' 
    }

}
function refundreasonfn(code){
    switch (code) {
        case 10:
            return "商品质量问题";
            break;
        case 11:
            return "其它原因";
            break;
        case 12:
            return "收到商品与网站展示不符(颜色、图片、规格、产地及详情描述)";
            break;
        case 13:
            return "客户原因无理由退货";
            break;
        case 14:
            return "资质问题";
            break;
        case 20:
            return "大小/型号与商品描述不符";
            break;
        case 30:
            return "颜色/图案与商品描述不符";
            break;
        case 40:
            return "功能/效果与商品描述不符";
            break;
        case 50:
            return "商城发错货";
            break;
        case 51:
            return "客户订购错误/计划有变";
            break;
        case 52:
            return "价格高";
            break;
        case 53:
            return "无法满足到货时效";
            break;
        case 54:
            return "支付问题";
            break;
        case 55:
            return "重复下单";
            break;
        case 56:
            return "暂时不需要了";
            break;
        case 57:
            return "订单信息有误";
            break;
        case 58:
            return "无货";
            break;
        case 59:
            return "其他";
            break;
        case 60:
            return "少件/漏发";
            break;
        case 61:
            return "商品质量问题";
            break;
        case 62:
            return "价格错误";
            break;
        case 70:
            return "多买/买错不想要了";
            break;
        case 80:
            return "到货物流破损";
            break;
        case 90:
            return "发票问题";
            break;
        case 100:
            return "未按约定时间送货";
            break;
        case 101:
            return "客户原因未收货";
            break;
        case 102:
            return "其它原因";
            break;
        case 103:
            return "现场无人收货";
            break;
        case 104:
            return "工地验收不合格";
            break;
        case 105:
            return "下错订单";
            break;
        case 106:
            return "送错货";
            break;
        case 107:
            return "客户地址留错";
            break;
        case 108:
            return "物流送货延迟";
            break;
        case 140:
            return "资质问题";
            break;
        case 53:
            return "货未集齐";
            break;
            default:'' 
    }
}
function getList(pagenum){
    $("#area").val()
    $.ajax({
        contentType: "application/json",
        type: "POST",
        /*root.orderInter.order_queryRefundOrder*/
        url:root.orderInter.order_queryRefundOrder ,
        cache: false,  //禁用缓存
        dataType: "json",
        data: JSON.stringify({
            "created_address_code": $("#area").val(),//地区
            "warehouse_id": $("#shippingWarehouse option:selected").val(),// 仓库id
            "refund_id":$("#applyCode").val(),//申请单号
            "created_at_begin":$("#applyTimeMin").val(),//申请开始时间
            "created_at_end":$("#applyTimeMax").val(),//申请结束时间
            "order_id":$("#orderCode").val(),//订单号
            "refund_sorce":$("#applyType").val(),//退货类型
            "refund_role":$("#returnType").val(),//退货渠道
            "refund_status":$("#dealState").val(),//状态
            /*"refund_reason": $("#reason").val(),//退货原因*/
            "customer_name":$("#buyerName").val(),//客户名称
//          "audit_person_name":$("#checker").val(),//审核人
            "sales_manager_name":$("#saleManager").val(),//销售经理
            "receiver_province": $("#getArea").val(),// 一级收货地（收货区域）
            "receiver_city": $("#getPlace").val(),// 二级收货地（收货位置）
            register_phone:$("#register_phone").val(),//注册手机号
            platform:$("#platform").val(),//订单来源
            companys_ids:sessionStorage.getItem("organizationWarehouse"),//公司对应的发货仓id
            warehouse_ids:sessionStorage.getItem("regions"),//仓库权限串
            belong_groupIds:sessionStorage.getItem("companys"),//销售归属权限串
            sales_manager_ids:sessionStorage.getItem("personnels"),//销售经理权限串
            "page_num":pagenum,
            "page_size":50,
            "refund_status_list":crmCustomerIdOnearry,
            paid_type: $("#payWay").val(), //支付方式
        }),
        success: function (data) {
            sessionStorage.setItem("returnstatus",'')
            orderList(data);
            $('.M-box3').pagination({
                pageCount: data.totalPage,
                jump: true,
                coping: true,
                prevContent: '上页',
                nextContent: '下页',
                callback: function (api) {
                    $.ajax({
                        contentType: "application/json",
                        type: "POST",
                        url:root.orderInter.order_queryRefundOrder,
                        cache: false,  //禁用缓存
                        dataType: "json",
                        data: JSON.stringify({
                            "created_address_code": $("#area").val(),//地区
                            "warehouse_id":$("#shippingWarehouse option:selected").val(),// 仓库id
                            "refund_id":$("#applyCode").val(),//申请单号
                            "created_at_begin":$("#applyTimeMin").val(),//申请开始时间
                            "created_at_end":$("#applyTimeMax").val(),//申请结束时间
                            "order_id":$("#orderCode").val(),//订单号
                            "refund_sorce":$("#applyType").val(),//退货类型
                            "refund_role":$("#returnType").val(),//退货渠道
                            "refund_status":$("#dealState").val(),//状态
                            "reason": $("#reason").val(),//退货原因
                            "customer_name":$("#buyerName").val(),//客户名称
//          "audit_person_name":$("#checker").val(),//审核人
                            "sales_manager_name":$("#saleManager").val(),//销售经理
                            "receiver_province": $("#getArea").val(),// 一级收货地（收货区域）
                            "receiver_city": $("#getPlace").val(),// 二级收货地（收货位置）
                            register_phone:$("#register_phone").val(),//注册手机号
                            platform:$("#platform").val(),//订单来源
                            companys_ids:sessionStorage.getItem("organizationWarehouse"),//公司对应的发货仓id
                            warehouse_ids:sessionStorage.getItem("regions"),//仓库权限串
                            belong_groupIds:sessionStorage.getItem("companys"),//销售归属权限串
                            sales_manager_ids:sessionStorage.getItem("personnels"),//销售经理权限串
                            "page_num":api.getCurrent(),
                            "page_size":50,
                            "refund_status_list":crmCustomerIdOnearry,
                            paid_type: $("#payWay").val(), //支付方式
                        }),
                        success: function (result) {
                            orderList(result);
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            alert(XMLHttpRequest);
                        }
                    });
                }
            });
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert(XMLHttpRequest);
        }
    });
}
/*跳转订单详情*/
function orderInfo(title,url,returnId,orderId){
    sessionStorage.setItem("returnId",returnId);
    sessionStorage.setItem("returnOrderId",orderId);
    var index = layer.open({
        type: 2,
        title: title,
        content: url
    });
    layer.full(index);
}
//交易状态
var placeholder02html =[];//存放多选时的html
var placeholder02htmlinit =[];
var crmCustomerIdOnearry =[];//存放多选时的crmCustomerid
var spanhtml = '';
var crmCustomerIdOne='';
$(".ulbox").css('display','none');
/*点击 项目 显示下拉 选项,其中全选全不选，要做传值的处理*/
$(".dataval,.icon_arrow").on('click',function (e) {
    $(this).parent().children(".icon_arrow").toggleClass("icon_arrow_down");
    if($('.ulbox').css("display") == "none"){
        $('.ulbox').show();
        if($(".placeholder02").find(".all-radius")&&$(".placeholder02").find(".all-radius").html()=="全部"){
            $(".placeholder02").html("")

        }
    }else{
        $(".ulbox").hide();
        if ($(".placeholder02").html()==""){
            $(".placeholder02").html('<span class="all-radius">全部</span>')
        }
    }
    /*------------------8.24 如果已经有选择过的--------------------*/
    var initcustomerId =[];
    placeholder02htmlinit=[]
    $.each($(".lidata"),function (index,itm) {

        initcustomerId.push($(itm).attr('crmCustomerId'))
        placeholder02htmlinit.push($(itm).attr('crmCustomername'))
    })
    if(crmCustomerIdOnearry.length >0){
        function isArray(str){
            return Object.prototype.toString.call(str) == "[object Array]";
        }
        if(isArray(crmCustomerIdOnearry)){
            crmCustomerIdOnearry= [crmCustomerIdOnearry].join().split(',');
        }else{
            crmCustomerIdOnearry= [crmCustomerIdOnearry].join().split(',');
        }
        $.each($(".lidata"),function (index,itm) {
            $.each(crmCustomerIdOnearry,function (i,item) {
                $.each(initcustomerId,function (j,ite) {
                    if(item == ite){
                        if($("itm").attr('crmcustomerid')==item){
                            $(".lidata").find('.evetyipt').prop('checked',true);
                        }
                    }
                })
            })
        })

    }
    e.stopPropagation();
});

var checkednum=0;
//当点击下拉数据时 回显在input里面
var htmlspan='';
$(".ulbox").on('click','input.evetyipt',function (e) {
    if($(".placeholder02").find(".all-radius")&&$(".placeholder02").find(".all-radius").html()=="全部"){
        $(".placeholder02").html("")

    }
    e.stopPropagation();
    if($(this).prop('checked')){
        $(this).prop('checked',true);//选中
        checkednum ++;
        spanhtml=$(this).next().html();
        placeholder02html.push(spanhtml);
        crmCustomerIdOne = $(this).parent().attr('crmCustomerId');
        crmCustomerIdOnearry.push(crmCustomerIdOne);
        $.each(placeholder02html,function(i,item){
            htmlspan = '<span>'+item+'</span>'
        })
        $(".placeholder02").append(htmlspan);
        if($(".ulbox").find('input.evetyipt').length == checkednum){
            $(".checkboxall").prev().prop('checked',true);
        }
        //全选反选时会用
        if (checkednum==0) {
            $(".checkboxall").prev().prop('checked',true);

        }
        //判断如果只选择了一个下拉选项 在input 里面应该展示全部的名称
        onenameadd()
    }else{
        checkednum --;
        $(this).prop('checked',false);
        var checkfalsehtml =  $(this).next().html();
        var tt =$(this).parent().attr('crmCustomerId');
        for (var i=0;i<crmCustomerIdOnearry.length;i++){
            if(crmCustomerIdOnearry[i] == tt){
                crmCustomerIdOnearry.splice(crmCustomerIdOnearry.indexOf(tt),1);
            }
        }
        var iptspandata = $('.placeholder02 span');//点击选中回显在span 里面的值
        $.each(iptspandata,function (i,item) {
            if($(item).html() == checkfalsehtml){
                $(item).html('');
                $(item).remove();
            }
        });
        placeholder02html.splice($(this).next().html(),1);
        if($(".ulbox").find('input.evetyipt').length != checkednum){
            $(".checkboxall").prev().prop('checked',false);
        }
        onename();
    }
});
//可点击空白处
$(document).click(function() {
    $(".ulbox").css('display','none');
    if ($(".placeholder02").html()==""){
        $(".placeholder02").html('<span class="all-radius">全部</span>')
    }
});
function onenameadd(){
    //判断如果只选择了一个下拉选项 在input 里面应该展示全部的名称
    if(crmCustomerIdOnearry.length == 1){
        $(".placeholder02 span").css('max-width','none');
        $(".placeholder02 span").attr('title',$(".placeholder02 span").html());
    }else{
        $(".placeholder02 span").css('max-width','48px');
    }
}
function onename(){
    //判断如果只选择了一个下拉选项 在input 里面应该展示全部的名称
    if(crmCustomerIdOnearry.length == 1){
        $(".placeholder02 span").css('max-width','none');
        $(".placeholder02 span").attr('title',$(".placeholder02 span").html());
    }
}

/*点击全选 联动 传值*/
var ulboxli = $(".ulbox").find('li');
$(".checkboxall").parent().on('click','input',function (e) {
    e.stopPropagation();
    if($(this).prop('checked')){//全选
        $(this).prop('checked',true);
        ulboxli.find('input').prop('checked',true);
        $(".placeholder02").html("")
        placeholder02html =placeholder02htmlinit;
        var htmlspan='';
        $.each(placeholder02html,function(i,item){
            htmlspan += '<span>'+item+'</span>'
        });
        var crmCustomerIds=$(this).attr('crmCustomerId')
        crmCustomerIdOnearry=crmCustomerIds.split(",")
        $(".placeholder02").append(htmlspan);
    }else{//全不选
        $(this).prop('checked',false);
        ulboxli.find('input').prop('checked',false);
        crmCustomerIdOnearry=[];
        placeholder02html=[];
        $(".placeholder02").html('');
    }
});
$(".ulbox").on('click','.checkboxall',function (e) {
    e.stopPropagation();
    if(  $(this).parent().find('input').prop('checked') == false){//全选
        $(this).parent().find('input').prop('checked',true);
        ulboxli.find('input').prop('checked',true);
        placeholder02html =placeholder02htmlinit;
        var htmlspan='';
        $.each(placeholder02html,function(i,item){
            htmlspan += '<span>'+item+'</span>'
        });
        $(".placeholder02").append(htmlspan);
    }else{//全不选
        $(this).parent().find('input').prop('checked',false);
        ulboxli.find('input').prop('checked',false);
        crmCustomerIdOnearry=[];
        placeholder02html=[];
        $(".placeholder02").html('');
    }
})

//弹框跳转
var returnstatus= sessionStorage.getItem("returnstatus")
if(returnstatus==10){
    crmCustomerIdOnearry=[]
    $('#dealState').val(returnstatus)
    crmCustomerIdOnearry.push(returnstatus)
    placeholder02html.push("待审核")
    var htmlspan=""
    $.each(placeholder02html,function(i,item){
        htmlspan += '<span>'+item+'</span>'
    });
    $(".placeholder02").html(htmlspan);
    $(".ulbox").find('input.evetyipt')[0].checked=true
    getList(1)
}
//重置

$("#ssss").on('click',function () {
    $(".kild").val("")
    $(".Validform_checktip").hide()
    crmCustomerIdOnearry=[];
    placeholder02html=[];
    $(".placeholder02").html("");

})
